package com.mrdeer.user.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.mrdeer.user.api.dto.tenant.AccountRoleDTO;
import com.mrdeer.user.api.dto.tenant.AccountRoleQueryDTO;
import com.mrdeer.user.api.dto.tenant.TenantDTO;
import com.mrdeer.user.api.dto.tenant.TenantQueryDTO;
import com.mrdeer.user.api.entity.Tenant;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @author ：xie jianchu
 * @date ：Created in 2020/9/8 0008 9:37
 */
@Repository
public interface TenantMapper extends BaseMapper<Tenant> {

    /**
     * 向租户-账号中间表插入数据
     *
     * @param id1
     * @param id2
     * @param isAdmin
     */
    void insertTenantAccount(@Param("id1") Long id1, @Param("id2") Long id2, @Param("isAdmin") Boolean isAdmin);

    List<TenantDTO> selectAccountInTenant(@Param("id") Long id);

    List<TenantDTO> selectTenantByPage(@Param("page") Page<TenantDTO> page, @Param("tenantQuery") TenantQueryDTO tenantQuery, @Param("sortBy") String sortBy, @Param("order") String order);

    List<AccountRoleQueryDTO> queryAdministratorByPage(@Param("page") Page<AccountRoleQueryDTO> page, @Param("query") AccountRoleDTO query);
}
